#include<stdio.h>
#include<unistd.h>

#define NUM 100
int main()
{
  char buf[NUM+1] = {0}; //最后一个位置要预留\0
  const char* str = "-|/\\";
  int i = 0;
  while(i<=NUM)
  {
    printf("[%-100s][%3d%%][%c]\r",buf,i,str[i%4]);
    fflush(stdout);
    buf[i++] = '=';
    usleep(50000);
  }
  printf("\n");
  return 0;
}
